import { PipeTransform } from '@nestjs/common'
import * as md5 from 'md5'

export class EncryptionPipe implements PipeTransform {
  transform(value: any): any {
    if (value.password) {
      value.password = this.encryption(value.password)
    }
    return value
  }

  encryption(password: string) {
    return md5(password)
  }
}
